'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE, NOW } = app.Sequelize;

  const ThumbsUp = app.model.define(
    'thumbs_up',
    {
      id: { type: INTEGER(10), primaryKey: true, autoIncrement: true },
      topicId: { type: INTEGER(10), allowNull: false }, // 帖子id
      userId: { type: STRING(255), allowNull: false }, // 用户id
      status: { type: INTEGER(1), allowNull: false }, // 帖子状态1: 点赞 0: 取消点赞
      created_at: { type: DATE, defaultValue: NOW }, // 回复创建时间
      updated_at: { type: DATE, defaultValue: NOW }, // 回复创建时间
    },
    {
      freezeTableName: true, // 不自动将表名添加复数
    }
  );

  return ThumbsUp;
};
